import * as constants from '../Constants'
import { get, GET_ONE_RESOLVE_LIST, GET_SAMPLE_MARKS } from '../../service/api'

export interface GetOneResolveList {
  type: constants.GetOneResolveList
  payload: Promise<any>
}
export interface GetOneResolveList_PENDING {
  type: constants.GetOneResolveList_PENDING
  payload: Promise<any>
}
export interface GetOneResolveList_FULFILLED {
  type: constants.GetOneResolveList_FULFILLED
  payload: any
}
export interface GetOneResolveList_Type {
  type: constants.GetOneResolveList_Type
  payload: number
}

export interface RECORD_OneResolve {
  type: constants.RECORD_OneResolve
  payload: Promise<any>
}

export interface RECORD_OneResolve_FULFILLED {
  type: constants.RECORD_OneResolve_FULFILLED
  payload: any
}

export type OneResolveAction = GetOneResolveList | 
  GetOneResolveList_FULFILLED | 
  GetOneResolveList_PENDING |
  GetOneResolveList_Type |
  RECORD_OneResolve |
  RECORD_OneResolve_FULFILLED

export function recordType(param: number): GetOneResolveList_Type {
  return {
    type: constants.GetOneResolveList_Type,
    payload: param
  }
}

export function recoreMakes(params: any): RECORD_OneResolve {
  return {
    type: constants.RECORD_OneResolve,
    payload: get(GET_SAMPLE_MARKS, params)
  }
}

export function getOneResolveList(param: any): GetOneResolveList {
  return {
    type: constants.GetOneResolveList,
    payload: get(GET_ONE_RESOLVE_LIST, param)
  }
}